<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
    <head>
        <%@include file="../common/head.jspf" %>
        <link rel="stylesheet" type="text/css" href="${rootPath}/js/plugins/summernote/summernote.css">
        <link rel="stylesheet" type="text/css" href="${rootPath}/js/plugins/summernote/summernote-bs3.css">
    </head>

    <body class="sb-l-o sb-r-c" data-menu="#menu_user" data-list="#li_user_list">

        <!-- 主体内容开始 -->
        <div id="main">

            <!--侧边导航栏-->
            <%@include file="../common/sidebar.jspf" %>

            <!-- Start: Content-Wrapper -->
            <section id="content_wrapper">

                <!-- 顶部导航 -->
                <header id="topbar">
                    <div class="topbar-left">
                        <ol class="breadcrumb">
                            <li class="crumb-active">
                                <span>软擎科技</span>
                            </li>
                            <li class="crumb-icon">
                                <a href="dashboard"><span class="glyphicon glyphicon-home"></span></a>
                            </li>
                            <li class="crumb-icon">
                                <a href="pointsystem/commoditylist">商品列表</a>
                            </li>
                            <!-- 当前页 -->
                            <c:choose>
                                <c:when test="${model != null}">
                                    <li class="crumb-trail">编辑商品</li>
                                    </c:when>
                                    <c:otherwise>
                                    <li class="crumb-trail">添加商品</li>
                                    </c:otherwise>
                                </c:choose>
                        </ol>
                    </div>
                    <div class="topbar-right">
                        <!-- 登录信息 -->
                        <%@include file="../common/session.jspf" %>
                    </div>
                </header>
                <!-- 顶部导航结束 -->

                <!-- 页面内容开始 -->
                <section id="content">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="mw500 mauto p10">
                                <c:choose>
                                    <c:when test="${model != null}">
                                        <h1 class="text-center text-muted-lighter mb20"><i class="fa fa-pencil-square-o mr5"></i>编辑商品</h1>
                                    </c:when>
                                    <c:otherwise>
                                        <h1 class="text-center text-muted-lighter mb20"><i class="fa fa-plus-square mr5"></i>添加商品</h1>
                                    </c:otherwise>
                                </c:choose>
                                <form class="form-horizontal gulangyu-form" role="form" id="commodityForm" novalidate>
                                    <input type="hidden" name="id" value="${model}" />
                                    <div class="form-group">
                                        <div class="input-group">
                                            <span class="input-group-addon">商品名称</span>
                                            <input class="form-control" 
                                                   type="text" 
                                                   name="cName"
                                                   id="cName"
                                                   required
                                                   placeholder="2-8位中文">
                                            <span class="append-icon right"><i class="fa fa-check"></i></span>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="input-group">
                                            <span class="input-group-addon">类型</span>
                                            <select name="rewardMethod" id="rewardMethod" class="multiselect" onchange="showredmoney();">
                                                <c:forEach items="${RewardMethod}" var="method">
                                                    <option value="${method}">${method.key}</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="form-group redmoney" style="display: none">
                                        <div class="input-group">
                                            <span class="input-group-addon">红包面值</span>
                                            <input class="form-control" 
                                                   type="text" 
                                                   name="redmoney"
                                                   id="redmoney"
                                                   placeholder="必须为数字">
                                            <span class="append-icon right"><i class="fa fa-check"></i></span>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="input-group">
                                            <span class="input-group-addon">商品分类</span>
                                            <select name="commodityCategory" id="commodityCategory" class="multiselect">
                                                <c:forEach items="${CommodityCategory}" var="commodity">
                                                    <option value="${commodity}">${commodity.key}</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="input-group">
                                            <span class="input-group-addon">商品描述</span>
                                            <input class="form-control" 
                                                   type="text" 
                                                   name="description"
                                                   id="description"
                                                   required
                                                   placeholder="">
                                            <span class="append-icon right"><i class="fa fa-check"></i></span>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="input-group">
                                            <span class="input-group-addon">商品单位</span>
                                            <input class="form-control" 
                                                   type="text" 
                                                   name="unit"
                                                   id="unit"
                                                   placeholder="2-8位中文">
                                            <span class="append-icon right"><i class="fa fa-check"></i></span>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="input-group">
                                            <span class="input-group-addon">对应积分</span>
                                            <input class="form-control" 
                                                   type="text" 
                                                   name="points"
                                                   id="points"
                                                   placeholder="必须为数字">
                                            <span class="append-icon right"><i class="fa fa-check"></i></span>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <button type="button" class="btn btn-primary btn-block" id="saveCommodityBtn">保存商品</button>
                                    </div>
                                    <div class="text-right">
                                        <a href="pointsystem/commoditylist">返回商品列表</a>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </section>
                <!-- 页面内容结束 -->
            </section>
        </div>
        <!-- 主体内容结束 -->

        <!-- 公共函数 -->
        <%@include file="../common/scripts.jspf" %>
        <script type="text/javascript" src="${rootPath}/js/admin-tools/admin-forms/js/jquery.validate.min.js"></script>
        <script type="text/javascript" src="${rootPath}/js/admin-tools/admin-forms/js/additional-methods.min.js"></script>
        <script type="text/javascript" src="${rootPath}/js/plugins/summernote/summernote.min.js"></script>
        <script type="text/javascript" src="${rootPath}/js/plugins/summernote/lang.js"></script>
        <script type="text/javascript" src="${rootPath}/js/pages/pointsystem/commodity_edit.js"></script>
    </body>
</html>